
    <link rel="stylesheet" href="../src/css/head.css">
    <div class="header-box">
        <div class="header">
            <a href="https://www.21cake.com/" id="logo">
            <img src="../src/imgs/logo.png" alt="">
            </a>
            <ul>
                <li><a href="http://127.0.0.1:5500/2004/sweetheart/html/index.html">首页</a></li>
                <li><a href="http://127.0.0.1:5500/2004/sweetheart/html/list.html">蛋糕</a></li>
                <li><a href="http://127.0.0.1:5500/2004/sweetheart/html/list.html">面包</a></li>
                <li><a href="http://127.0.0.1:5500/2004/sweetheart/html/list.html">冰淇淋</a></li>
                <li><a href="http://127.0.0.1:5500/2004/sweetheart/html/list.html">咖啡下午茶</a></li>
                <li><a href="http://127.0.0.1:5500/2004/sweetheart/html/list.html">全国送</a></li>
                <li><a href="http://127.0.0.1:5500/2004/sweetheart/html/list.html">企业专区</a></li>
            </ul>
            <div class="right">
                <a class="app" href="">APP下载</a>
                <a class="map" href="">上海</a>
                <a class="xiao" href="">消息</a>
                <span class="sp1">
                    <a href="http://127.0.0.1:5500/2004/sweetheart/html/denglu.html">登录</a>/
                    <a href="http://127.0.0.1:5500/2004/sweetheart/html/zhuce.html">注册</a>
                </span>
                <span class="sp2">
                    欢迎您：<span class="name">eqwe</span>
                </span>
                <a  class="car" href="http://127.0.0.1:5500/2004/sweetheart/html/cart.html"><i class="i_1"></i></a>
            </div>
        </div>
    </div>







    <script>
            function getAllCookie() {
                var cookie = document.cookie;
                var list = cookie.split('; ');
                return list.reduce(function (total, value) {
                    total[value.split('=')[0]] = value.split('=')[1]
                    return total;
                }, {});
            }
            // 获取特定的cookie
             function getCookie(name) {
                return getAllCookie()[encodeURIComponent(name)] ? decodeURIComponent(getAllCookie()[encodeURIComponent(name)]) : '';
            }

            var username = getCookie('login_user')
            if( username){
                $('.sp2').css('display','block')
                $('.sp1').css('display', 'none')
                $('.name').text(username)
            }else{
                $('.sp1').css('display','block')
            }



           
    </script>